package com.kkb.kkbadmin.service.util;

import com.kkb.kkbadmin.domain.Recommend;
import com.kkb.kkbcommon.exception.Asserts;

import java.math.BigDecimal;

/**
 * @author 陈家兴
 * @Classname ValidateUtil
 * @Description 内推多字段效验工具类
 * @Date 2021/8/14 14:48
 */
public class RecommendValidateUtil {

    public static void validatedYearAndSalary(Recommend recommend) {
        BigDecimal positionMaxYear = recommend.getPositionMaxYear();
        BigDecimal positionMinYear = recommend.getPositionMinYear();
        BigDecimal positionSalaryMax = recommend.getPositionSalaryMax();
        BigDecimal positionSalaryMin = recommend.getPositionSalaryMin();
        //校验年限大小关系
        if (positionMaxYear.compareTo(positionMinYear) < 1) {
            Asserts.fail("参数出错大小关系出错,positionMaxYear(职位要求最大年限)【<=】positionMinYear(职位要求最小年限)");
        }
        //校验月薪大小关系
        if (positionSalaryMax.compareTo(positionSalaryMin) < 1) {
            Asserts.fail("参数出错大小关系出错,positionSalaryMax(职位最大月薪)【<=】positionSalaryMin(职位最小月薪)");
        }
    }
}
